package com.ad.pet.message.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.R;
import com.ad.pet.common.data.utils.glide.GlideUtil;
import com.ad.pet.models.remote.message.Message;

import java.util.List;


/**
 * Created by SEELE on 2018/8/20.
 */

public class OrderMessageAdapter extends BaseQuickAdapter<Message, BaseViewHolder> {
    public OrderMessageAdapter(@Nullable List<Message> data) {
        super(R.layout.item_order_msg, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Message item) {
        TextView tvTime = helper.getView(R.id.tv_time);
        ImageView iv_head = helper.getView(R.id.iv_head);
        ImageView ivPoint = helper.getView(R.id.iv_point1);
        TextView tvTittle = helper.getView(R.id.tv_title);
        TextView tvContent = helper.getView(R.id.tv_content);

        if (!TextUtils.isEmpty(item.getImg())) {
            GlideUtil.load(mContext, item.getImg(), iv_head);
        }
        ivPoint.setVisibility(item.getRead() == 0 ? View.VISIBLE : View.GONE);
        tvTittle.setText(item.getTitle());
        tvTime.setText(item.getAddtime());
        tvContent.setText(item.getContent());
    }
}
